
import com.baidubce.http.ApiExplorerClient;
import com.baidubce.http.AppSigner;
import com.baidubce.http.HttpMethodName;
import com.baidubce.model.ApiExplorerRequest;
import com.baidubce.model.ApiExplorerResponse;

// 短信验证码短信通知接口 Java示例代码
public class test {
    public static void main(String[] args) {
        String path = "http://gyytz.api.bdymkt.com/sms/send";
        ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path);
        request.setCredentials("41af0651682a4caeb15f26021372119d", "aab4b4a2139445cf89f4c366cdecc761");

        // 设置header参数
        request.addHeaderParameter("Content-Type", "application/json; charset=utf-8");

        // 设置query参数
        request.addQueryParameter("mobile", "18730679827");
        request.addQueryParameter("param", "123456");
        request.addQueryParameter("smsSignId", "2e65b1bb3d054466b82f0c9d125465e2");
        request.addQueryParameter("templateId", "8166a0ae27b7499fa8bdda1ed12a07bd");


        ApiExplorerClient client = new ApiExplorerClient(new AppSigner());

        try {
            ApiExplorerResponse response = client.sendRequest(request);
            // 返回结果格式为Json字符串
            System.out.println(response.getResult());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}